<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="lo">位置信息</div>
<script>
    if (navigator.geolocation !== undefined) {
        console.log(12132123);
        navigator.geolocation.getCurrentPosition(function (position) {
            var lat = position.coords.latitude;
            var lng = position.coords.longitude;
            console.log(lat, lng);

            document.getElementById('lo').innerHTML = "位置信息 lat: " + lat + " lng: " + lng;
        }, function (error) {
            console.log(error.code, error.message)
        }, {enableHighAccuracy: true});
    }
</script>
</body>
</html>